﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

// std headers
#include <memory>
#include <vector>

// qt headers
#include <QString>
#include <QObject>

// gcmp headers

// custom headers


namespace gmepgcs
{
    struct ICategory;

}

namespace gmepgcs
{
    class SelectingFileItem : public QObject
    {
        Q_OBJECT

    public:
        explicit SelectingFileItem(const QString filePath, QObject *parent = nullptr);
        virtual ~SelectingFileItem();

    public:
        QString Id() const;
        QString FilePath() const;
        QString FileName() const;
        double FileSize() const;
        QString FileSizeStr(const char &unit = 'K', const int &precision = 0) const;    
        QString CategoryFullName() const;
        QString Remark() const;
        std::wstring CategoryCode() const;
        std::wstring GacProjectAppVersion() const;
        std::wstring GacProjectAppName() const;
        QString GacProjectAppMainVersion() const;
        std::wstring GetCategoryGuid() const;

        bool IsSelected() const;
        void SetIsSelected(const bool &isSelected);

        bool IsSelectable() const;



    signals:
        void SelectionChanged(bool &selected);

    private:
        void Init();
        int CompareVersion(const QString &version1, const QString &version2);

    private:
        QString m_id;
        QString m_filePath;
        QString m_fileName;
        double m_fileSize;
        std::wstring m_categoryGuid;

        QString m_categoryFullName;
        std::wstring m_categoryCode;
        std::wstring m_gacProjectAppName;
        std::wstring m_gacProjectAppVersion;
        QString m_gacProjectAppMainVersion;
        QString m_remark;
        bool m_isSelected;
        bool m_isGacProjectAppVersionChecked;
        bool m_isGacCategoryChecked;
        bool m_isCategoryMapped;
    };
}